<?php
	defined('_JEXEC') or die;
    jimport('joomla.application.component.controller');
    class NormalController extends JController
    {
		function display() {		
			// $app =& JFactory::getApplication();
			// $app->setTemplate("gippslandsitetemplate2"); 
			
			$viewName = JRequest::getVar('view');
			if($viewName == '')
				$viewName = 'normal'; //default view;
			
			$model = & $this->getModel('normal');	
			$view = & $this->getView($viewName, 'html');
			$view->setModel($model);
						
			$app = JFactory::getApplication();			
			$app->setTemplate("gippslandsitetemplate2"); 
			
			if($viewName = "filedetail")
			{
				$id = JRequest::getVar('fileId');
				$data = array();
				$path = JURI::base() . 'components/com_volunteer/Audio/';
				$data['linkToFile'] = $path . $model->getFile($id)->url;
				
				$app->setUserState('normal.filedetail.form.data', $data);
			}
			$view->display();
		}
		
		function searchfile()
		{
			$location = JRequest::getVar('location');
			$timespan = JRequest::getVar('timespan');
			$industry = JRequest::getVar('industry');
			$keywords = JRequest::getVar('keywords');
			
			$this->setRedirect(JRoute::_('index.php?option=com_normal&view=normal&location=' . $location . '&timespan=' . $timespan . '&industry=' . $industry . '&keywords=' . $keywords . '#content'));
			return false;
		}
    }
